#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct op{
    int a;
    short i;
};
int n,m,t,a1[100005],lk[4],a[100005],s[150000],ans=0,w[19]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144};
op c[100005];
bool r[70000];
int cmp(op a,op b){
    return a.a<b.a;
}
int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    cin >> n >> m;
    for (int i=1;i<=n;i++)
        cin >> a1[i];
    for (int i=1;i<=n;i++){
        cin >> c[i].a;
        c[i].i=i;
    }

    sort(c+1,c+m+1,cmp);
    for (int i=0;i<n;i++){

    }
    cin >> t;
    for (int oiu=0;oiu<t;oiu++){
        cin >> lk[0] >> lk[1] >> lk[2] >> lk[3];
        for (int i=1;i<=n;i++)
            a[i]=a1[i]^lk[i%4];

    }
    return 0;
}
